{% extends "student/layout.html" %}

{% set page_title = __('详细信息') %}

{% block content %}
<div class="m-scontent">
    <div class="m-detail-score">
        <div class="title">
            <div class="name">{{ data.number }}.{{ __(data.lesson) }}</div>
            {% if data.remark_class == 'unfinished' %}
            <div class="date">（{{__('乐曲未学完')}}）</div>
            {% endif %}
        </div>
        <div class="wrap">
            <div class="agent">
                <div class="date">{{__('开课时间')}}：{{ __(data.time[:2] + '月') }}{{ data.time[3:] }}{{__('日')}}</div>
                <div class="agent-name">{{__('机构名称')}}: {{ data.school_name }}</div>
                <div class="teacher-name">{{__('教师')}}：{{ data.teacher_name }}</div>
            </div>
            {% if data.remark_class != 'unfinished' %}
            <div class="final-score"><span class="sub">{{__('结果成绩')}}：</span>{{ data.remark }}</div>
            {% endif %}
        </div>
        {% if current_user.course_type == 'course_adults' or current_user.course_type == 'course_xi_yang_hong' %}
        <div class="wrap">
            <div class="theory">
                <span class="title">{{__('乐理知识')}}</span>
                <ul>
                    {% for knowlege in data.knowledge %}
                    <li>{{ loop.index }}.{{ data.knowledge[loop.index -1] }}</li>
                    {% endfor %}
                </ul>
            </div>
            <div class="score">
                <span class="title">{{__('成绩')}}</span>
                <ul>
                    <li>
                        <span class="name">{{__('卡拉PK')}}</span>
                        {% if 'pk_kara' not in data %}
                            <span class="fenshu"></span>
                        {% else %}
                            {% if data.pk_kara.score == '' %}
                                <span class="fenshu"></span>
                                <span class="sub">{{__('无卡拉pk')}}</span>
                            {% else %}
                            <span class="fenshu">{{ data.pk_kara.score}}</span>
                            <span class="sub">{{__('分')}}</span>
                                {% if data.pk_kara.exist_pic %}
                                    <i id="{{ data.pk_kara.activity_id }}" class="iconfont icon-file alert-score"></i>
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    </li>
                    <li>
                        <span class="name">{{__('分句PK')}}</span>
                        {% if 'pk_part' not in data %}
                            <span class="fenshu"></span>
                        {% else %}
                            {% if data.pk_part.score == '' %}
                                <span class="fenshu"></span>
                                <span class="sub">{{__('无分句PK')}}</span>
                            {% else %}
                            <span class="fenshu">{{ data.pk_part.score}}</span>
                            <span class="sub">{{__('分')}}</span>
                                {% if data.pk_part.exist_pic %}
                                    <i id="{{ data.pk_part.activity_id }}" class="iconfont icon-file alert-score"></i>
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    </li>
                    <li>
                        <span class="name">{{__('乐谱PK（慢速）')}}</span>
                        {% if 'pk_score_slow' not in data %}
                            <span class="fenshu"></span>
                        {% else %}
                            {% if data.pk_score_slow.score == '' %}
                                <span class="fenshu"></span>
                                <span class="sub">{{__('无乐谱PK')}}</span>
                            {% else %}
                            <span class="fenshu">{{ data.pk_score_slow.score}}</span>
                            <span class="sub">{{__('分')}}</span>
                                {% if data.pk_score_slow.exist_pic %}
                                    <i id="{{ data.pk_score_slow.activity_id }}" class="iconfont icon-file alert-score"></i>
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    </li>
                    <li>
                        <span class="name">{{__('乐谱PK（中速）')}}</span>
                        {% if 'pk_score_mid' not in data %}
                            <span class="fenshu"></span>
                        {% else %}
                            {% if data.pk_score_mid.score == '' %}
                                <span class="fenshu"></span>
                                <span class="sub">{{__('无乐谱PK')}}</span>
                            {% else %}
                            <span class="fenshu">{{ data.pk_score_mid.score}}</span>
                            <span class="sub">{{__('分')}}</span>
                                {% if data.pk_score_mid.exist_pic %}
                                    <i id="{{ data.pk_score_mid.activity_id }}" class="iconfont icon-file alert-score"></i>
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    </li>
                    <li>
                        <span class="name">{{__('乐谱PK（原速）')}}</span>
                        {% if 'pk_score' not in data %}
                            <span class="fenshu"></span>
                        {% else %}
                            {% if data.pk_score.score == '' %}
                                <span class="fenshu"></span>
                                <span class="sub">{{__('无乐谱PK')}}</span>
                            {% else %}
                            <span class="fenshu">{{ data.pk_score.score}}</span>
                            <span class="sub">{{__('分')}}</span>
                                {% if data.pk_score.exist_pic %}
                                    <i id="{{ data.pk_score.activity_id }}" class="iconfont icon-file alert-score"></i>
                                {% endif %}
                            {% endif %}
                        {% endif %}
                    </li>
                    <li>
                        <span class="name">{{__('演奏')}}</span>
                        {% if 'test_play' not in data %}
                        <span class="fenshu"></span>
                        {% else %}
                            <span class="fenshu">{{ data.test_play.score}}</span>
                            <span class="sub">{{__('分')}}</span>
                            {% if data.test_play.exist_pic %}
                                <i id="{{ data.test_play.activity_id }}" class="iconfont icon-file alert-score"></i>
                            {% endif %}
                        {% endif %}
                    </li>
                </ul>
            </div>
        </div>
        {% else %}
        <div class="wrap">
            <div class="theory">
                <span class="title">{{__('乐理知识')}}</span>
                <ul>
                    {% for knowlege in data.knowledge %}
                    <li>{{ loop.index }}.{{ data.knowledge[loop.index -1] }}</li>
                    {% endfor %}
                </ul>
            </div>
            <div class="score">
                <span class="title">{{__('成绩')}}</span>
                <ul>
                    <li><span class="name">{{__('分句PK')}}</span>
                    <span class="fenshu">{% if 'pk_part' not in data %}</span>{% else %}{{ data.pk_part.score}}</span>
                    {% if data.pk_part.score != "" %}<span class="sub">{{__('分')}}</span>{% endif %}{% endif %}
                    </li>
                    <li><span class="name">{{__('全曲PK')}}</span>
                    <span class="fenshu">{% if 'pk_full' not in data %}</span>{% else %}{{ data.pk_full.score}}</span>
                    {% if data.pk_full.score != "" %}<span class="sub">{{__('分')}}</span>{% endif %}{% endif %}
                    </li>
                    <li><span class="name">{{__('小考核－演奏')}}</span>
                    <span class="fenshu">{% if 'test_play' not in data %}</span>{% else %}{{ data.test_play.score }}</span>
                    {% if data.test_play.score != "" %}<span class="sub">{{__('分')}}</span>{% if data.test_play.exist_pic %}<i id="{{ data.test_play.activity_id }}" class="iconfont icon-file alert-score"></i>{% endif %}{% endif %}{% endif %}</li>
                    <li><span class="name">{{__('小考核－乐理')}}</span>
                    <span class="fenshu">{% if 'test_music_theory' not in data %}</span>{% else %}
                    {% if not data.test_music_theory.score %}{{__('无此步骤')}}{% else %}{{ data.test_music_theory.score}}{% endif %}</span>{% endif %}</li>
                    <li><span class="name">{{__('小考核－听力')}}</span>
                    <span class="fenshu">{% if 'test_listen' not in data %}</span>{% else %}
                    {% if not data.test_listen.score %}{{__('无此步骤')}}{% else %}{{ data.test_listen.score}}{% endif %}</span>{% endif %}</li>
                </ul>
            </div>
        </div>
        {% endif %}
    </div>
</div>

<div class="modal fade" style="overflow:scroll;" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog  modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="modalTitle">{{__('成绩单')}}</h4>
      </div>
      <div class="modal-body">

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">{{__('关闭')}}</button>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% block js %}
<script type="text/javascript">

$('.iconfont').bind('click',function(){
        var activity_id = $(this).attr('id');
        console.dir(activity_id)
        var url = '/student/record/images/' + activity_id;
        $.get(url, function(data){
            if (data['code']!=0){
                alert(data['msg']);
                return;
            }else{
                var htmlStr = '';
                var imagePaths = data['data']['images'];
                for (var i in imagePaths){
                    htmlStr += '<img width="800px" src="' + imagePaths[i] + '" />';
                }
                $('#myModal .modal-body').html(htmlStr);
                $('#myModal').modal('show');
                $('.modal-body>img').width('800px');
            }

        }, 'json');
    });
</script>
{% endblock %}
